package com.neuedu.hcp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.Patient;
import com.neuedu.hcp.entity.RecoveryPlan;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.mapper.PatientMapper;
import com.neuedu.hcp.mapper.RecoveryPlanMapper;
import com.neuedu.hcp.service.IPatientService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class PatientServiceImpl extends ServiceImpl<PatientMapper, Patient> implements IPatientService {
    @Autowired
    private PatientMapper patientMapper;
    /**
     * 获取所有康复计划（分页）
     * @param currentPage
     * @param size
     * @param patient
     * @return
     */

    @Override
    public RespPageBean getPatientListByPage(Integer currentPage, Integer size, Patient patient) {
        Page<Patient> page = new Page<>(currentPage,size);


        IPage<Patient> patientIPage=patientMapper.getPatientListByPage(page,patient);



        RespPageBean respPageBean = new RespPageBean(patientIPage.getTotal(),patientIPage.getRecords());
        return respPageBean;
    }

    @Override
    public int insert(Patient patient) {
        return patientMapper.insert(patient);
    }







}
